package com.ecommerce.dal.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ecommerce.dal.dao.impl.CompanyDAO;
import com.ecommerce.dal.entity.Company;
import com.ecommerce.dal.service.ICompanyManagerService;


@Service("companyManagerService")
public class CompanyManagerService implements ICompanyManagerService {

	@Autowired
	CompanyDAO companyDAO;
	@Override
	public Company retrieveCompany(long companyId) {
		return companyDAO.findByCompanyId(companyId); 
	}


	@Override
	public void saveCompany(Company company) {
		companyDAO.save(company);
		
	}

	@Override
	public List<Company> retrieveAllCompanies() {
		return companyDAO.findAllCompanies();
	}

	@Override
	public Company retrieveCompanyByItem(long itemId) {
		return companyDAO.findCompanyByItem(itemId);
	}


	@Override
	public void updateCompany(Company company) {
		companyDAO.update(company);
		
	}

	@Override
	public void deleteCompany(Company company) {
		companyDAO.delete(company);
		
	}

}
